# 代码分析工具
# $1 指定分析的目录,默认分析RFM_DEVICE_A020项目

ARM_GCC_DIR_LINUX=/c/SiliconLabs/SimplicityStudio/v5/developer/toolchains/gnu_arm/10.3_2021.10/bin

if [ ! -n "$1" ]; then
    DIR=../RFM_DEVICE_A020/
    SIZEFILE=RFM_DEVICE_A020.log
else
    DIR=../$1/
    SIZEFILE=$1.log
fi



rm -rf $SIZEFILE

find "$DIR" -type f -name "*.o" -print0 | while read -d $'\0' object_file; do
  $ARM_GCC_DIR_LINUX/arm-none-eabi-size "$object_file"  -G -x  >> $SIZEFILE
  echo "--------------------------------------------------------------" >> $SIZEFILE
done
